package com.common.retrofit.methods;

import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.entity.result.AreaBean;
import com.common.retrofit.entity.result.CityCodeBean;
import com.common.retrofit.service.HaiNingService;

import java.util.ArrayList;

import rx.Observable;
import rx.Subscriber;

public class GetCityAreaMethods extends BaseMethods {

    private static GetCityAreaMethods m_ins = null;

    public static GetCityAreaMethods getInstance() {
        if (m_ins == null) {
            synchronized (GetCityAreaMethods.class) {
                if (m_ins == null) {
                    m_ins = new GetCityAreaMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
            return "House/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }

    // 获取首页数据
    public void search_city(Subscriber<AreaBean> subscriber, String keyword ) {
        Observable observable = initService().get_area_str(System.currentTimeMillis()+"",
                "b13501350a22ceca810436e8a328f307",keyword );
        toSubscribe(observable, subscriber);
    }
}
